import math
class Point:
	""" This class holds de information and actions related to points
	
	Fields:
	x: x coordinate of the point
	y: y coordinate of the point
	
	"""
	
	def __init__(self, x, y):
		self.x = int(x)
		self.y = int(y)

	def rotate(self,angle,center):
		sin, cos = math.sin(angle), math.cos(angle)
		self.x ,self.y = self.x-center.x,self.y-center.y
		self.x,  self.y = int(center.x + cos*self.x + sin*self.y), int(center.y + cos*self.y - sin*self.x)
	
	def translate(self,dx,dy):
		self.x+=dx
		self.y+=dy

	def __add__(self, p):
		return Point(self.x + p.x, self.y + p.y)
	
	def __sub__(self, p):
		return Point(self.x - p.x, self.y - p.y)
		
	def norm(self):
		return (self.x**2 + self.y**2)**0.5

	def __getitem__(self,a):
		if a==0:
			return self.x
		else:
			return self.y
